-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updating Trackable::association_hash to write through parent. #34
Conversation
Currently there are cases (on destroy mianly) where an child document would write it's class name to the association_hash 'name' field. This happens when it fails to lookup the relationship meta information pertaining to it's parent OR when the child has been deleted off the parent record before the destroy history track has been written. Then if you are trying to use that history track later on, it would fail the to be able to lookup it's trackable_parent, among other methods, because it would try to traverse a relationship titled "Comment" instead of the actual name of teh association, 'comments'. This fix makes it so a child document doesn't fail to lookup the name of the relation, when a parent is present, regardless of when the delete occurs.
|
||
inverse = node._parent.reflect_on_association(meta.inverse) if meta | ||
#We prefer to look up associations through the parent record because |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to be picky, could you please fix spelling in this comment (exist is misspelled exsist) and add a space after a # :) thx.
Good. I'll merge it after the comment fixes. Thanks. |
@dblock Sorry about the typos. Let me know if there's anything else. |
Merging this, /cc: @aq1018 |
Updating Trackable::association_hash to write through parent.
thanks! @dblock! |
@dblock, are you able to release the gem? I've been caught up in a few projects and getting quite busy lately. |
Currently there are cases (on destroy mianly) where an child document
would write it's class name to the association_hash 'name' field. This
happens when it fails to lookup the relationship meta information pertaining to it's
parent OR when the child has been deleted off the parent record before
the destroy history track has been written.
Then if you are trying to use that history track later on, it would fail
the to be able to lookup it's trackable_parent, among other methods,
because it would try to traverse a relationship titled "Comment"
instead of the actual name of teh association, 'comments'.
This fix makes it so a child document doesn't fail to lookup the name of
the relation, when a parent is present, regardless of when the delete
occurs.